package bean;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import java.io.Serializable;
import java.lang.reflect.Type;

public class BaseJsonBean implements Serializable {

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    public JSONObject toJson() {
        return (JSONObject) JSONObject.toJSON(this);
    }

    public Object resolver(JSONObject object){
        return JSON.parseObject(toString(), (Type) this);
    }

}
